package top.haichi.webpaper.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import top.haichi.webpaper.entity.Student;

@Mapper
public interface StudentMapper extends BaseMapper<Student> {

    /**
     * id查询学生存在
     * @param student
     * @return
     */
    @Select("Select id from student where id = #{id}")
    public Student getIdById(Student student);

    /**
     * id查询学生
     * @param student
     * @return
     */
    @Select("select id,name,class_name,gender,major,email from student where id = #{id}")
    public Student getStudentByid(Student student);

    /**
     * 新增学生
     * @param student
     */
    @Insert("insert into student(id,name,class_name,gender,major,email,has_portrait) values (#{id},#{name},#{className},#{gender},#{major},#{email})")
    public void addStudent(Student student);

    /**
     * 上传头像后把has_portrait改为true
     * @param student
     */
    @Update("update student set has_portrait = true where id = #{id}")
    public void updatePortrait(Student student);

    public void updateStudentInformation(Student student);

}
